Copyright: Copyright © ArGo Software Design, 1997


Contents
The Internet Mail Suite Plus

The Internet Mail Suite Plus, on top of components included in the Internet Mail Suite, contains the following components:

TmsArticle

TmsNNTP

TagFTP

TagFinger

TagWhoIs

TagTime

This package is still in Beta.  Please visit our web site at:

http://www.argosoft.com

to obtain the latest version.  Your suggestions and ideas are welcome to support@argosoft.com


TmsArticle component

properties	methods

unit

msMsg;

Implements the usenet newsgroup article.  Descends from TmsCustomMessage component, which is also an ancestor of TmsMessage component, used for email messages.  The main difference between TmsMessage and TmsArticle is the following:  TmsArticle does not contain properties which are not used in the Usenet, such as Recipients, ReturnReceipt, Priority, CC and BCC.  Instead it has a new header, which is required in NNTP - NewsGroups.


TmsArticle properties

Attachments

Body

CharSet

ContentType

Encoding

Headers

NewsGroups

Sender

Subject


NewsGroups property

unit msMsg;

applies to:

TmsArticle component;

declaration:

property NewsGroups : string;

description

Lists newsgroups where the article will be posted if you call msNNTP.PostArticle method, or, if the article has been retrieved from the server, contains the list of newsgroups where the message was cross posted. The names of the newsgroups would be comma-separated.

important:  if you are using the 16 bit version of the Internet Mail Suite, please keep in mind the 255 character limit.  This is one of the limitations of the 16 bit version.


TmsArticle methods
Assign

Clear

ExecuteAttachment (32 bit version only)

LoadFromStream

LoadFromFile

SaveAttachment

SaveToStream

SaveToFile

Verify


TagFinger component

properties	methods	events

unit

agFinger;

declaration

TagFinger = class(TagSocket);

description

TagFinger implements one of the simplest Internet protocols - Finger Information Protocol, which is documented in rfc1288. Finger protocol provides the interface to a remote user information program (RUIP).

You can use Finger protocol to connect to the remote host and retrieve the information about the particular user, or, by sending the empty query, you can get the information about users who are currently online.

Please keep in mind that not all the hosts are running finger server. If this is the case you will rather receive 'Connection Refused' or 'Timed Out' error.

Usage of TagFinger component is very simple.  All you have to do is just set the Query property and call Execute method.  The output returned from Server will be stored in TagFinger.OutStream, which you can parse and display.  Take a look at fingdemo.dpr application to find out how to use TagFinger component.


TagFinger properties
DefaultPort

Query

RAS

OutStream

TimeOut

WinsockAvailable

WinsockLoaded


Query property (TagFinger)

unit

agFinger

applies to:

TagFinger component

declaration:

property Query : string;

description

Contains the query which will be sent to the finger server.  It always has to contain @ symbol. Tagfinger uses the string contained on the right side of @ symbol as a name of server, and the string contained on the left side of @ symbol as a query which will be sent to the server.  This part can be blank.  In general, the query can be an email address.  The query will be sent when you call Execute method of TagFinger component.

Examples of valid queries are:

jdoe@pobox.com

@ils.unc.edu


InStream property

unit

agFinger

applies to:

TagFinger and TagWhoIs components

declaration:

property InStream : TMemoryStream;

description:

Public, run time and read only.  Contains the data received from the finger or whois server after running Execute method of TagFinger or TagWhoIs component.  You can parse received data and perform the actions you wish.  For example, if you want to display received data in TMemo, then you can do the following:

Memo1.Lines.LoadFromStream(agFinger1.InStream);

or you can save the received data into the file:

agFinger1.InStream.SaveToFile('c:\temp\finger.txt');


TagFinger methods
Execute


Execute method (TagFinger)

unit

agFinger

applies to

TagFinger component

description

procedure Execute;

declaration

Connects to finger server defined in the right side of the Query, sends a query, defined in the left side, receives the information from server, which will be saved in OutStream and closes the connection to the server.

The following example sends the query and saves the received information into the file:

agFinger1.Query:='jdoe@domain.com';

agFinger1.Execute;

agFinger.OutStream.SaveToFile(FileName);


TagFinger events
OnRecvProgress

OnOpen

OnClosing

OnClosed

OnCancel

OnError

OnSendingQuery


OnSendingQuery event

unit

agFinger

applies to:

TagFinger, TagWhoIs components;

declaration:

property OnSendingQuery : TNotifyEvent;

description

Is triggered just before TagFinger or TagWhoIs component sends a query to the server.


TagWhoIs component

properties	methods	events

unit

agWhoIs;

declaration

TagWhois = class(TagSocket);

description

TagWhoIs implements simple internet protocol, also known as Nickname and documented in rfc954.  WhoIs servers are running on the hosts which provide net wide directory services for Internet users.  So, there are only few servers which provide this service.  One of the examples is whois.internic.net.

Whois service is based on query/response protocol.  To obtain the list of available commands you can send HELP command.  Check out whdemo.dpr program, which comes with the Internet Mail Suite Plus.

Usage of TagWhoIs component is very simple.  All you have to do is set Server and Query properties and call Execute method.  The received data will be placed in TagWhoIs.OutStream property.


TagWhoIs properties
DefaultPort

Query

RAS

Server

InStream

TimeOut

WinsockAvailable

WinsockLoaded


Execute method (agWhoIs)

unit

agWhoIs

applies to

TagWhoIs component

description

procedure Execute;

declaration

Connects to whois server, sends a query, receives the information from server, which will be saved in OutStream and closes the connection to the server.

The following example sends the query and saves the received information into the file:

agWhoIs1.Query:='argosoft.com';

agFinger1.Execute;

agFinger.OutStream.SaveToFile(FileName);


TagWhoIs methods
execute


Query property (TagWhoIs)

unit

agWhoIs

applies to:

TagWhoIs component

declaration:

property Query : string;

description

Contains the query which will be sent to the whois server. The query will be sent when you call Execute method of TagWhoIs component.  To obtain the list of possible query strings send HELP, take a look at whdemo.dpr application included in the Internet mail suite.


TagWhoIs events
OnRecvProgress

OnOpen

OnClosing

OnClosed

OnCancel

OnError

OnSendingQuery


TagTime properties
DefaultPort

DateTime

Query

RAS

Server

OutStream

TimeOut

WinsockAvailable

WinsockLoaded


TagTime component

properties	methods	events

unit

agTime;

declaration

TagTime = class(TagSocket);

description:

TagTime component is an implementation of the Time protocol, described in rfc822.  Time protocol provides a site-independent, machine readable date and time.  Time service sends back to the originating source the time in seconds since midnight  on January 1st 1900.

To use TagTime component you will need just to set Server property and call Execute method.  Result will be returned in TagTime.DateTime property.  You can use retrieved data e.g. to update computer clock.


DateTime property

unit

agTime;

applies to:

TagTime component;

declaration:

property DateTime : TDateTime;

description

Contains the date and time returned by time server (in UTC).


TagTime methods
execute


Execute method (TagTime)

unit

agTime;

applies to:

TagTime component

declaration:

procedure Execute;

description

Connects to the host specified in Server property, receives the 32 bit long integer, closes connection with the server and fills DateTime property.


TagTime events
OnOpen

OnClosing

OnClosed

OnCancel

OnError

OnConnected


TmsNNTP properties

Article

CurrentArticle

DefaultPort

FirstArticle

LastArticle

LastHeaderNumber

LogFileName

NewGroup

NewsHeadersList

NewsGroupList

RAS (32 bit only)

Server

TimeOut

TotalArticles

WinsockAvailable

WinsockLoaded


TmsNNTP component

properties	methods	events

unit

msNNTP;

declaration

TmsNNTP=class(TagSocket);

description

Gives you an access to the Usenet Newsgroups.  Implements Network News Transfer Protocol (NNTP) documented in rfc977.

TmsNNTP component works in conjunction with TmsArticle component.  You should assign the TmsArticle component to the Article property of TmsNNTP in order to use it.  You can do it at run time, or via object inspector:  drop TmsNNTP and TmsArticle component onto the form and set the Article property of TmsNNTP component.


msNNTP methods

LoadNewsGroupList

RetrieveCurrentArticle

RetrieveArticleByNumber

RetrieveArticleById

SetNextArticle

RetrieveAllHeaders

RetrieveNewsGroupList

RetrieveNextNHeaders

PostArticle

SaveNewsGroupList


TmsNNTP events

OnArticleRetrieved

OnCancel

OnClosed

OnClosing

OnError

OnGroupSelected

OnLastHeaderRetrieved

OnNextHeaderRetrieved

OnOpen

OnPosted

OnPosting

OnProgress


Article property

unit

msNNTP;

applies to:

TmsNNTP component;

declaration:

property Article : TmsArticle;

description

This property will be filled in by itself after you call of RetrieveCurrentArticle, RetrieveArticleByID or RetrieveArticleByNumber methods of TmsNNTP component.  On the other hand, you should fill the Article property yourself before you call PostArticle method.

For example, the following code:

msArticle1.Clear;

msArticle1.Sender.Address:='jdoe@domain.com';

msArticle1.Subject:='How to post usenet articles?';

msArticle1.NewsGroups:='alt.news, alt.questions';

msArticle1.Body.Add('Hi All');

msArticle1.Body.Add('Does anyone know how to post usenet articles?');

msArticle1.Body.Add('John');

msNNTP1.PostArticle;

will post the article.  This example assumes that msArticle1 is set to the Article property of msNNTP1.


CurrentArticle property

unit

msNNTP;

applies to:

TmsNNTP component;

declaration:

property CurrentArticle : LongInt;

description:

Public property.  Points to current article in the current NewsGroup.  Should be in FirstArticle... LastArticle range.  Call of RetrieveCurrentArticle will retrieve the article number CurrentArticle.  Has meaning only if NewsGroup property is set.


FirstArticle property

unit

msNNTP;

applies to:

TmsNNTP component;

declaration:

property FirstArticle : LongInt;

description:

Number of first available article in the current newsgroup.  Has meaning only if NewsGroup is selected.


LastArticle property

unit

msNNTP;

applies to:

TmsNNTP component;

declaration:

property LastArticle : LongInt;

description:

Number of last available article in the selected Newsgroup.


LastHeaderNumber property

unit

msNNTP;

applies to:

TmsNNTP component;

declaration:

property LastHeaderNumber : LongInt;

description:

 Contains the number of the article, information about which is contained in the last item of NewsHeaderList property.  Used as a pointer for continuing header information retrieval when your application calls RetrieveNextNHeaders method.  You can set this number yourself, but it should be in FirstArticle... LastArticle range.  Has meaning only when NewsGroup property is set.


NewGroup property

unit

msNNTP;

applies to:

TmsNNTP component;

declaration:

property NewsGroup : string;

description:

Run Time property.  If you set this property TmsNNTP component will try to connect to the server and switch to the specified newsgroup.  FirstArticle, LastArticle, TotalArticles and CurrentArticle properties will be set to the appropriate values.


NewsHeadersList property

unit

msNNTP;

applies to:

TmsNNTP component;

declaration:

property NewsHeadersList : TmsNgInfoList;

description:

Holds the information about headers of the articles contained in the current NewsGroup.  This list will be filled in after you call RetrieveNextNHeaders or RetrieveAllHeaders methods.

Each item is a TmsNgInfoItem object, which descends from TmsHeaders class, and, in addition, contains the Number field, which corresponds to the number of the article in newsgroup.

Since TmsNgInfoItem descends from TmsHeaders, you can use all methods of this object.  For example, if you want to retrieve the Subject header of the article, which is no i in the NewsHeadersList, you should call:

s:=NewsHeadersList[i].GetFieldBody('Subject');

and then, if you like this article and want to retrieve it, just call:

msNNTP1.RetrieveArticleByNumber(msNNTP1.NewsHeadersList[i].Number);

msNNTP1.Article will be filled in by retrieved data.


TmsNgInfoList and TmsNgInfoItem classes reference

Here is how TmsNgInfoList and TmsNgInfoItem classes are declared in msnwscls.pas unit.

  TmsNgInfoItem = class(TmsHeaders)

  private

    FNumber : LongInt;

  public

    property Number : LongInt read FNumber write FNumber;

  end;

  TmsNgInfoList = class(TPersistent)

  private

    FList : TList;

    function Get(Index : Integer) : TmsNgInfoItem;

    procedure Put(Index : Integer; Value : TmsNgInfoItem);

    function GetCount : Integer;

  public

    constructor Create;

    destructor Destroy; override;

    function Add(Value : TmsNgInfoItem) : Integer;

    procedure Clear;

    property Items[Index : Integer] : TmsNgInfoItem read Get write Put; default;

    property Count : Integer read GetCount;

  end;


TotalArticles property

unit

msNNTP;

applies to:

TmsNNTP component;

declaration:

property TotalArticles : LongInt;

description:

Estimated number of the articles in the newgroup.  Is returned by server after you select NewsGroup property.


RetrieveCurrentArticle method

unit

msNNTP;

applies to:

TmsNNTP component;

declaration:

procedure RetrieveCurrentArticle;

description:

Retrieves the article pointed by CurrentArticle property.  The retrieved data will be placed in the Article property.  Has meaning only if NewsGroup is selected.

If you wish to retrieve the current article and display it's body into the memo, you can use the following code:

msNNTP1.RetrieveCurrentArticle;

Memo1.Lines:=msNNTP1.Article.Body;


RetrieveArticleByNumber method

unit

msNNTP;

applies to:

TmsNNTP component;

declaration:

procedure RetrieveArticleByNumber(Num : LongInt);

description:

Resets CurrentArticle to the number specified in the Num parameter and retrieves the article.  Retrieved data will be placed in Article property.  Will work only if NewsGroup property is set to the valid value.


RetrieveArticleById method

unit

msNNTP;

applies to:

TmsNNTP component;

declaration:

procedure RetrieveArticleById(const Id : string);

description

Retrieves a NNTP article by Id.  NewGroup property does not have to be set to the valid value.  Id can be obtained from any source, e.g. you can parse References header and find the Id of the article which was the previous one in the thread.  Also, you can get the message Id from NewsHeadersList.


SetNextArticle method

unit

msNNTP;

applies to:

TmsNNTP component;

declaration:

function SetNextArticle : boolean;

description

Sets CurrentArticle to the next available article.  Usage of SetNextSrticle is more reliable than looping from FirstArticle to LastArticle, since some articles in the newsgroup may be missing.  Returns true if the operation was successful, otherwise, if there are no more available articles, returns false.  NewsGroup property must be set.


RetrieveAllHeaders method

unit

msNNTP;

applies to:

TmsNNTP component;

declaration:

procedure RetrieveAllHeaders;

description

Fills NewsHeaderList by looping through all available articles in the newsgroup.  Has meaning only if NewsGroup property is set correctly.


RetrieveNextNHeaders method

unit

msNNTP;

applies to:

TmsNNTP component;

declaration:

procedure RetrieveNextNHeaders(N : Integer; Append : boolean);

description

Retrieves next N available headers in the newsgroup.  The last retrieved header is set in LastHeaderNumber property.  If number of available headers is less than N then retrieves all remaining possible headers and triggers OnLastHeaderRetrieved event.  If Append parameter is true, then the list will be appended to the last item of NewsHeadersList, otherwise NewsHeadersList will be cleared and new headers will be added to blank list.  Has meaning only if NewsGroup property is set.


PostArticle method

unit

msNNTP;

applies to:

TmsNNTP component;

declaration:

procedure PostArticle;

description

Post an article to the newsgroups specified in the NewsGroups property of the Article.  Before calling this method you have to fill in the Article property of the TmsNNTP component.   Short example is shown in the Article topic.

You may want to add additional headers to the Article property.  You can do it before calling PostArticle method very easily, using Headers property:

.

.

msArticle1.Headers.Add('Organization: ArGo Software Design');

.

.

NewsGroup property does not have to be set in order to use this method.


OnArticleRetrieved event

unit

msNNTP;

applies to:

TmsNNTP component;

declaration:

property OnArticleRetrieved : TNotifyEvent;

description

Will be called as soon as the article has been retrieved from the server.  You can use this event handler to display the information on the status bar, or play sound or for other purposes.


OnGroupSelected event

unit

msNNTP;

applies to:

TmsNNTP component;

declaration:

property OnGroupSelected : TNotifyEvent;

description

Called after NewsGroup property has been set.


OnLastHeaderRetrieved event

unit

msNNTP;

applies to:

TmsNNTP component;

declaration:

property OnLastHeaderRetrieved : TNotifyEvent;

description

Triggered by RetrieveNextNHeaders method when it reaches the last available article in the newsgroup.


OnPosted event

unit

msNNTP;

applies to:

TmsNNTP component;

declaration:

property OnPosted : TNotifyEvent;

description

Called after the server returns the reply that the article has been successfully posted after calling PostArticle method.


OnPosting method

unit

msNNTP;

applies to:

TmsNNTP component;

declaration:

property OnPosting : TNotifyEvent;

description

Called after you call PostArticle method. You should wait for OnPosted event to be sure that the article has been successfully posted.


OnNextHeaderRetrieved event

unit

msNNTP;

applies to:

TmsNNTP component;

declaration:

property OnNextHeaderRetrieved : TmsNumNotifyEvent;

description

Triggered from RetrieveAllHeaders or RetrieveNextNHeaders methods when next header item is retrieved and appended to the NewsHeadersList.  You can use this method to update the information in the control which displays retrieved headers.  Take a look at msnntp.dpr demo application to find out more about using this event handler.


NewsGroupList property

unit

msNNTP;

applies to:

TmsNNTP component;

declaration:

property NewsGroupList : TmsNewsGroupList;

description:

Contains a list of newsgroups, available on the server.  Each item of NewsGroupList is of type TmsNewsGroup.  There are two ways to fill NewsGroupList property.  You can call RetrieveNewsGroupList method to retrieve the latest list from server, or load it from the file, using LoadNewsGroupList method.  In the latter case the file must exist and has to be created previously by SaveNewsGroupList method.


TmsNewsGroup and TmsNewsGroupList reference

TmsNewsGroup and TmsNewsGroupList types are defined in msnwscls.pas unit.

  TmsNewsgroup = class

    FirstArticle : LongInt;

    LastArticle : LongInt;

    Flag : Char;  {'y'-posting allowed, 'n'-posting not allowed, 'm'-moderated}

    Name : string;

  end;

  TmsNewsGroupList = class(TPersistent)

  private

    FList : TList;

    function Get(Index : Integer) : TmsNewsGroup;

    procedure Put(Index : Integer; Value : TmsNewsGroup);

    function GetCount : Integer;

  protected

    function PickAPart(s : string; Position : Integer) : string;

  public

    constructor Create;

    destructor Destroy; override;

    function Add(Value : TmsNewsGroup) : Integer;

    procedure SaveToFile(const FileName : string);

    procedure SaveToStream(Stream : TStream);

    procedure LoadFromFile(const FileName : string);

    procedure LoadFromStream(Stream : TStream);

    procedure Clear;

    property Items[Index : Integer] : TmsNewsGroup read Get write Put; default;

    property Count : Integer read GetCount;

  end;


RetrieveNewsGroupList method

unit

msNNTP;

applies to:

TmsNNTP component;

declaration:

procedure RetrieveNewsGroupList;

description:

Retrieves a list of available articles on the current server.  The results are placed in the NewsGroupList property.  Since retrieval of thousands of groups can take a time, you can save the retrieved list using SaveNewsGroupList method and fill the NewsGroupList property later, by calling LoadNewsGroupList method.


LoadNewsGroupList method

unit

msNNTP;

applies to:

TmsNNTP component;

declaration:

procedure LoadNewsGroupList(const FileName : string);

description:

Loads the list of available newsgroups from the file.  The file must be created previously using SaveNewsGroupList method, and the list of available newsgroups should be retrieved using RetrieveNewsGroupList method.  Call of this method fills in the NewsGroupList property.


SaveNewsGroupList method

unit

msNNTP;

applies to:

TmsNNTP component;

declaration:

procedure SaveNewsGroupList(const FileName : string);

description:

Saves the information about available newsgroups into the file.  This information can be retrieved later by calling LoadNewsGroupList method.  The information about available newsgroups can be retrieved from server by calling RetrieveNewsGroupList method.


TagFTP component

properties	methods	Events

unit

agFTP;

declaration

TagFTP=class(TagSocket);

description

Implements one of the most popular protocols on the Internet - File Transfer Protocol.  Gives you a possibility to upload and download the files, also browse the directories on the remote computers.

In v1.8 this component is in beta.  All suggestions and bug reports are welcome.  Please send them to support@argosoft.com.

The demo program for Borland C++ Builder is not included in this release.  We will be doing it in the final version.  But it does not mean that TagFTP component will not work with BCBuilder.


TagFTP properties

DefaultPort

Directory

Password

RAS (32 bit only)

RetrievingList

Server

TimeOut

TransferType

TransferBufferSize

TransferringFile

UserName

WinsockLoaded


Password property

unit

agFTP

applies to

TagFTP component;

declaration

property Password : string;

description

Login password to the FPT server.  Should be set, along with UserName property, before calling OpenConnection method, i.e. before logging into the FTP server.


UserName property

unit

TagFTP

applies to

TagFTP component;

declaration

property UserName : string;

description

User name for logging into the FTP server.  Should be set together with Password property before calling OpenConnection method.


TransferType property

unit

agFTP

applies to

TagFTP component

declaration

property TransferType : TTransferType;

description

Transfer type for files to or from the FTP server.  Should be set to ftBinary for binary files and to ftAscii for text files.


TTransferType type
TTrabsferType type

unit

agFTP;

description

TTransferType = (ftBinary, ftAscii);

The type of TransferType property of TagFTP component.


TransferBufferSize property

unit

agFTP;

applies to

TagFTP component;

declaration

property TransferBufferSize : Cardinal;

description

Size of the transfer buffer for the file transfers in TagFTP component.  Default value is 2048.  You may experiment with this number if the quality of lines is not good.


TagFTP Events

OnCancel

OnClosed

OnClosing

OnConnected

OnError

OnLineReceived

OnLineSent

OnOpen

OnTransferEnd

OnTransferProgress

OnTransferStart


OnTransferStart event

unit

agFTP

applies to:

TagFTP component

declaration

property OnTransferStart : TNotifyEvent;

description

Triggered when transfer of the data starts in the TagFTP component.  This event is called when TagFTP component either requests the contents of directory list, or when it starts the file transfer via data channel.  Your application can check RetrievingList or TransferringFile properties to find out which case we are dealing with.  You can use this event to display the status message, check out the FTPDemo application to find out how you can use this event handler.


OnTransferEnd event

unit

agFTP

applies to:

TagFTP component

declaration

property OnTransferEnd : TNotifyEvent;

description

Triggered when transfer of the data ends in the TagFTP component.


OnTransferProgress event

unit

agFTP

applies to:

TagFTP component

declaration

property OnTransferProgress : TmsProgressEvent;

description

Called during the data transfer progress in TagFTP component.  It is called in both cases - either when retrieving the directory list of when transferring the file via data channel.  Again, your application can check out RetrievingList or TransferringFile properties to find out which process is occurring.


RetrievingList property

unit

agFTP

applies to

TagFTP component

declaration

property RetrievingList : boolean;

description

Runtime and read only.  Returns true if agFTP component tries to retrieve the directory list.


TransferringFile property

utin

agFTP;

applies to

TagFTP component

declaration

property TranferringFile : boolean;

description

Runtime and read only.  Returns true when file transfer in TagFTP component is in progress.


TagFTP methods

AbortTransfer

ChangeDirectory

ChangeToUpperDirectory

CloseConnection

DeleteDirectory

DeleteFile

LogIn

LogOut

MakeDirectory

OpenConnection

RenameFile

RetrieveFile

StoreFile

GetDirectory


AbortTransfer method

unit

agFTP

applies to

TagFTP component

description

procedure AbortTransfer;

declaration

Aborts file transfer or retrieving of the directory list.


ChangeDirectory method

unit

agFTP

applies to

TagFTP component

description

procedure ChangeDirectory(const Path : string);

declaration

Requests from server to change the current directory by sending CWD command through control channel.  You have to be logged into the server to use this method.


ChangeToUpperDirectory method

unit

agFTP

applies to

TagFTP component

description

procedure ChangeToUpperDirectory;

declaration

Requests from server to change to the parent directory by sending CDUP command through control channel.  You have to be logged into the server to use this command.


CloseConnection method

unit

agFTP

applies to

TagFTP component

description

procedure CloseConnection;

declaration

If you are logged into the server, logs you out, calling LogOut method, then closes the control socket.  If you are already logged out, does nothing.


OpenConnection method

unit

agFTP

applies to

TagFTP component

description

procedure OpenConnection;

declaration

If you are not logged into the server, logs you in, calling LogIn method.  If you are already logged in, does nothing.


LogIn method

unit

agFTP

applies to

TagFTP component

description

procedure LogIn;

declaration

Opens the connectio to the with Server, then sends authentication information (USER and PASS commands) and if the information supplied in UserName and Password properties is correct, logs you into the server.


LogOut method

unit

agFTP

applies to

TagFTP component

description

procedure LogOut;

declaration

Sends QUIT command to the server and logs you out.


DeleteDirectory method

unit

agFTP

applies to

TagFTP component

description

procedure DeleteDirectory(const Path : string);

declaration

Requests from server to delete the directory indicated in Path parameter, by issuing RMD command.  You have to be logged into the server to use this method.


DeleteFile method

unit

agFTP

applies to

TagFTP component

description

procedure DeleteFile(const FileName : string);

declaration

Requests from server to delete the file indicated in the FileName parameter, by issuing DELE command.  You have to be logged into the server to use this method.


MakeDirectory method

unit

agFTP

applies to

TagFTP component

description

procedure MakeDirectory(const Path : string);

declaration

Requests from server to create a directory indicated in Path parameter, by issuing MKD command.  You have to be logged into the server to use this method.


RenameFile method

unit

agFTP

applies to

TagFTP component

description

procedure RenameFile(const OldFileName, NewFileName : string);

declaration

Requests from server to rename the file from OldFileName to NewFileName, by issuing RNFR and RNTO commands.  You have to be logged into the server to use this method.


RetrieveFile method

unit

agFTP

applies to

TagFTP component

description

procedure RetrieveFile(const RemoteFilePath, LocalFilePath : string);

declaration

Retrieves the file RemoteFilePath from the server and stores it locally as LocalFilePath.  You have to be logged into the server to use this file.  For example, if you wish to retrieve the file imsp.zip from directory /argosoft from anonymous server at users.aol.com and store it at the local machine under the name imsp.zip you should do the following:

procedure GetFile;

begin

  agFTP1.UserName:='anonymous';

  agFTP1.Password:='guest@';

  agFTP1.Server:='users.aol.com';

  agFTP1.OpenConnection;

  try

    agFTP1.RetrieveFile('/argosoft/imsp.zip','imsp.zip');

  finally

    agFTP1.CloseConnection;

  end;

end;


StoreFile method

unit

agFTP

applies to

TagFTP component

description

procedure StoreFile(const LocalFilePath, RemoteFilePath : string);

declaration

Stores the file indicated in LocalFilePath parameter on the remote server under the name RemoteFilePath.  You have to be logged into the server if you wish to use this method.

The following code stores the file at c:\temp\readme.txt and anonymous server at members.aol.com, in the directory \argosoft\incoming using ASCII transfer type:

procedure PutFile;

begin

  agFTP1.UserName:='anonymous';

  agFTP1.Password:='guest@';

  agFTP1.Server:='members.aol.com';

  agFTP1.TransferType:=ftASCII;

  agFTP1.OpenConnection;

  try

    agFTP1.StoreFile('c:\temp\readme.txt','/argosoft/incoming/readme.txt');

  finally

    agFTP1.CloseConnection;

  end;

end;


GetDirectory method

unit

agFTP

applies to

TagFTP component

description

procedure GetDirectory;

declaration

Retrieves the information about current directory on the server, filling in Directory property of TagFTP component.


Directory property

unit

agFTP

applies to

TagFTP component

description

property Directory : TagFTPDirList;

declaration

This is a list of TagFTPDirEntry objects, which contains the information about each item of current working directory on the remote system.  You should call GetDirectory method after changing the directory to fill in this list.

For example, the following code saves the report about the current directory intot the file:

procedure MakeReport;

var

  i : Integer;

  f : TextFile;

begin

  AssignFile(f,'report.txt');

  Rewrite(f);

  for i:=0 to agFTP1.Directory.Count-1 do

  begin

    case agFTP1.Directory[i].Kind of

      fkFile : WriteLn(f,'File');

      fkDirectory : WriteLn(f,'Directory');

      fkLink : WriteLn(f,'Link');

    end;

    WriteLn(f,'Name: ',agFTP1.Directory[i].FileName);

    WriteLn(f,'Size: ',agFTP1.Directory[i].Size);

    WriteLn(f,'Date: ',DateTimeToStr(agFTP1.Directory[i].Date);

    if agFTP1.Directory[i].Kind=fkLink then

      WriteLn(f,'Link points to: ',agFTP1.Directory[i].LinkPtr);

  end;

  CloseFile(f);

end;

TagFTP component tries to fill in this list based on the text data sent by the server after issuing LIST FTP command.  Unfortunately the structure of this text data is not standardized.  We tried to take into account all popular formats, we performed extensive tests and it looks like everything works fine with Unix and DOS based FTP servers.  If you encounter the servers which return the data in different format and TagFTP component cannot parse it, please let us know at support@argosoft.com and we will try to fix the problem.


TagFTPDirList type

unit

agFTPCls

declaration

  TagFTPDirList = class(TPersistent)

  private

    FList : TList;

    function Get(Index : Integer) : TagFTPDirEntry;

    procedure Put(Index : Integer; Value : TagFTPDirEntry);

    function GetCount : Integer;

  public

    constructor Create;

    destructor Destroy; override;

    function Add(Value : TagFTPDirEntry) : Integer;

    function AddString(const s : string) : Integer;

    procedure Clear;

    property Items[Index : Integer] : TagFTPDirEntry read Get write Put; default;

    property Count : Integer read GetCount;

  end;

Contains the list of each entry of the directory.  This is a type of the Directory property of TagFTP component.  Each item of this list of TagFTPDirEntry object.  Probably you will not need to fill this list, you will only need to use the items of this list.  See Directory topic for example, also take a look at ftpdemo application, included in the Internet Mail Suite Plus.


TagFTPDirEntry type

unit

TagFTPCls;

declaration

  TagFTPDirEntry=class

    Kind : TFileKind;

    FileName : ShortString;

    Size : LongInt;

    Date : TDateTime;

    LinkPtr : ShortString;

  end;

description

Contains the information about each entry of the Directory property of TagFTP component.  The majority of the fields of this class are self explanatory.  LinkPtr contains the string which actually points to the resource, if Kind field is fkLink.


TFileKind type

unit

agFtpCls;

declaration

  TFileKind = (fkUnknown, fkFile, fkDirectory, fkLink);

description

This is a type of the Kind field of TagFTPDirEntry class.  Indicates the kind of the directory entry on the server.